package com.dnui.seven2.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dnui.seven2.entity.Merch;
import com.dnui.seven2.entity.Performer;
import com.dnui.seven2.service.PerformerService;
import com.dnui.seven2.mapper.PerformerMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author fengy
 * @description 针对表【performer】的数据库操作Service实现
 * @createDate 2022-10-16 09:11:38
 */
@Service
public class PerformerServiceImpl extends ServiceImpl<PerformerMapper, Performer>
        implements PerformerService{

    @Autowired
    private PerformerMapper performerMapper;

    @Override
    public List<Performer> selectAll() {
        //构造条件构造器
        LambdaQueryWrapper<Performer> queryWrapper=new LambdaQueryWrapper();
        List<Performer> performers = performerMapper.selectList(null);
        return performers;
    }

    @Override
    public List<Performer> queryPerformers(Integer currentPageNum, Integer everyPage) {
        Page page=new Page(currentPageNum,everyPage);
        performerMapper.selectPage(page, null);
        return page.getRecords();
    }



    @Override
    public void deletePerformer(Long performerId) {
        performerMapper.deleteById(performerId);
    }

    @Override
    public void updatePerformer(Performer performer) {
        performerMapper.updateById(performer);
    }
}




